package com.senmo.activity.main;

import com.senmo.fragment.MainTabDevice;
import com.senmo.fragment.MainTabDiscover;
import com.senmo.fragment.MainTabPersonal;
import com.senmo.senmo.R;

public enum MainTab {

	DEVICE(0, R.string.main_tab_device, R.string.main_tab_device_icon, MainTabDevice.class),
	DISCOVER(1, R.string.main_tab_discover, R.string.main_tab_discover_icon, MainTabDiscover.class),
	PERSONAL(2, R.string.main_tab_personal, R.string.main_tab_personal_icon, MainTabPersonal.class),
    ;

	private int idx;
	private int resName;
	private int resIcon;
	private Class<?> clz;

	MainTab(int idx, int resName, int resIcon, Class<?> clz) {
		this.idx = idx;
		this.resName = resName;
		this.resIcon = resIcon;
		this.clz = clz;
	}

	public int getIdx() {
		return idx;
	}

	public int getTitleRes() {
		return resName;
	}

	public int getIconRes() {
		return resIcon;
	}

	public Class<?> getClz() {
		return clz;
	}

    public static MainTab getTabByIndex(int idx) {
        for (MainTab tab : values()) {
            if (tab.getIdx() == idx) {
                return tab;
            }
        }
        return null;
    }

}
